<style>
	table{
		width: 100%;
		border-collapse: collapse;
	}

	tr td{
		padding: 2px 0;
	}

	tr.total td{
		border-top:1px solid #000;
	}
</style>
<p style="text-align:center;">Balance Report <?=$sy;?></p>
<?if($result):?>

	<table>
		<?foreach($result as $k => $v):
			$total[] = $v['remaining_balance'];
		?>
			<tr>
				<td><?=$v['fullname'];?></td>
				<td><?=$v['grade_level'];?></td>
				<td><?=$v['gender'];?></td>
				<td style="text-align:right"><?=number_format($v['remaining_balance'],2,'.',',');?></td>
			</tr>
		<?endforeach;?>
		<tr class="total">
			<td></td>
			<td></td>
			<td>Total:</td>
			<td style="text-align:right"><?=number_format(array_sum($total),2,'.',',');?></td>
		</tr>
	</table>
<?else:?>
	<p>No Data Result.</p>
<?endif;?>